import numpy as np
arr = np.arange(24).reshape(4, 6)
print("原数组:\n", arr)
print("水平分割:\n", np.hsplit(arr, 2))
print("垂直分割:\n", np.vsplit(arr, 2))

# Output:
#     原数组:
#      [[ 0  1  2  3  4  5]
#      [ 6  7  8  9 10 11]
#      [12 13 14 15 16 17]
#      [18 19 20 21 22 23]]
#     水平分割:
#      [array([[ 0,  1,  2],
#            [ 6,  7,  8],
#            [12, 13, 14],
#            [18, 19, 20]]), array([[ 3,  4,  5],
#            [ 9, 10, 11],
#            [15, 16, 17],
#            [21, 22, 23]])]
#     垂直分割:
#      [array([[ 0,  1,  2,  3,  4,  5],
#            [ 6,  7,  8,  9, 10, 11]]), array([[12, 13, 14, 15, 16, 17],
#            [18, 19, 20, 21, 22, 23]])]
# %%